﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using DddCms.Domain.Repository;
using DddCms.Domain.Model;

namespace DddCms.Infrastructure.Repository
{
   
    public class UserRepository : RepositoryItem<User>, IUserRepository
    {

        protected override IDbSet<User> GetObjectQuery()
        {
            return dataContext.User;
        }

        public bool AlreadyExist(string username)
        {
            return GetObjectQuery().Any(user => user.UserName == username);
        }



        public User FindByName(string username)
        {
            return GetObjectQuery().Single(u => u.UserName == username);
        }

    
    }
}
